package com.donfu.system.service.house.impl;

import java.util.Date;
import java.util.List;

import com.donfu.system.domain.house.HouseStoreArticle;
import com.donfu.system.mapper.house.HouseStoreArticleMapper;
import com.donfu.system.service.house.IHouseStoreArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.util.HtmlUtils;

/**
 * 店铺内的文章Service业务层处理
 * 
 * @author donfu
 * @date 2021-12-09
 */
@Service
public class HouseStoreArticleServiceImpl implements IHouseStoreArticleService
{
    @Autowired
    private HouseStoreArticleMapper houseStoreArticleMapper;

    /**
     * 查询店铺内的文章
     * 
     * @param id 店铺内的文章主键
     * @return 店铺内的文章
     */
    @Override
    public HouseStoreArticle selectHouseStoreArticleById(Long id)
    {
        HouseStoreArticle houseStoreArticle = houseStoreArticleMapper.selectHouseStoreArticleById(id);
        String content = houseStoreArticle.getContent();
        String s = HtmlUtils.htmlUnescape(content);
        houseStoreArticle.setContent(s);
        return houseStoreArticle ;
    }

    /**
     * 查询店铺内的文章列表
     * 
     * @param houseStoreArticle 店铺内的文章
     * @return 店铺内的文章
     */
    @Override
    public List<HouseStoreArticle> selectHouseStoreArticleList(HouseStoreArticle houseStoreArticle)
    {
        return houseStoreArticleMapper.selectHouseStoreArticleList(houseStoreArticle);
    }

    /**
     * 新增店铺内的文章
     * 
     * @param houseStoreArticle 店铺内的文章
     * @return 结果
     */
    @Override
    public int insertHouseStoreArticle(HouseStoreArticle houseStoreArticle)
    {
        houseStoreArticle.setCreateDate(new Date());
        return houseStoreArticleMapper.insertHouseStoreArticle(houseStoreArticle);
    }

    /**
     * 修改店铺内的文章
     * 
     * @param houseStoreArticle 店铺内的文章
     * @return 结果
     */
    @Override
    public int updateHouseStoreArticle(HouseStoreArticle houseStoreArticle)
    {
        return houseStoreArticleMapper.updateHouseStoreArticle(houseStoreArticle);
    }

    /**
     * 批量删除店铺内的文章
     * 
     * @param ids 需要删除的店铺内的文章主键
     * @return 结果
     */
    @Override
    public int deleteHouseStoreArticleByIds(Long[] ids)
    {
        return houseStoreArticleMapper.deleteHouseStoreArticleByIds(ids);
    }

    /**
     * 删除店铺内的文章信息
     * 
     * @param id 店铺内的文章主键
     * @return 结果
     */
    @Override
    public int deleteHouseStoreArticleById(Long id)
    {
        return houseStoreArticleMapper.deleteHouseStoreArticleById(id);
    }
}
